package h_udp;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;

/**
 * @author Cheng-02
 * @version V1.0
 * @Package h_udp
 * @date 2024/4/14 下午3:16
 */
public class Server {
    public static void main(String[] args) {
        try {
            DatagramSocket socket = new DatagramSocket(6666);
            byte[]bytes=new byte[1024];
            DatagramPacket s=new DatagramPacket(bytes, bytes.length);
            socket.receive(s);
            byte[] data = s.getData();
         int len=s.getLength();
            InetAddress address = s.getAddress();
            int port = s.getPort();


        } catch (SocketException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
